package com.wuzheng.wisgo.sanitation.cloud.repository.mapper.job;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.wuzheng.wisgo.sanitation.cloud.model.job.pojo.JobRoadDTO;
import com.wuzheng.wisgo.sanitation.cloud.model.road.RoadStateDTO;
import com.wuzheng.wisgo.sanitation.cloud.repository.builder.job.JobRoadBuilder;
import com.wuzheng.wisgo.sanitation.cloud.repository.entity.job.JobRoad;
import com.wuzheng.wisgo.sanitation.cloud.repository.handler.ArrayType2Handler;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

/**
 * 作业道路 Mapper 接口
 *
 * @author hoipang
 * @since 2019-12-10
 */
public interface JobRoadMapper extends BaseMapper<JobRoad> {

    /**
     * 查询作业道路特定信息分页列表
     *
     * @param page
     * @param name
     * @param code
     * @return
     */
    @SelectProvider(type = JobRoadBuilder.class, method = "buildConditionOfJobRoadDTOSql")
    @Results(
            @Result(column = "gpsFeatures", property = "gpsFeatures", typeHandler = ArrayType2Handler.class)
    )
    List<JobRoadDTO> pageJobRoadDTOs(Page page, @Param("id") String id, @Param("name") String name, @Param("code") String code);

    /**
     * 查询作业道路特定信息列表
     *
     * @param name
     * @param code
     * @return
     */
    @SelectProvider(type = JobRoadBuilder.class, method = "buildConditionOfJobRoadDTOSql")
    @Results(
            @Result(column = "gpsFeatures", property = "gpsFeatures", typeHandler = ArrayType2Handler.class)
    )
    List<JobRoadDTO> listJobRoadDTOs(@Param("id") String id, @Param("name") String name, @Param("code") String code);

    /**
     * 查询作业道路状态
     * @return
     */
    @SelectProvider(type = JobRoadBuilder.class, method = "buildListRoadStateDTOSql")
    @Results(
            @Result(column = "gpsFeatures", property = "gpsStatus", typeHandler = ArrayType2Handler.class)
    )
    List<RoadStateDTO> listRoadStateDTOs();

    /**
     * 查询作业道路详情
     *
     * @param id
     * @return
     */
    @SelectProvider(type = JobRoadBuilder.class, method = "buildConditionOfJobRoadDTOSql")
    @Results(
            @Result(column = "gpsFeatures", property = "gpsFeatures", typeHandler = ArrayType2Handler.class)
    )
    JobRoadDTO selectJobRoadDTO(@Param("id") String id, @Param("name") String name, @Param("code") String code);
}
